home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1992 April
/
1992-04.d64
/
trapezium rule
(
.txt
)
< prev
Wrap
Commodore BASIC
|
2022-09-20
|
266b
|
18 lines
10 rem -- trapezium rule --
20 print"[147]"
30 def fna(x)=1/x
40 print"[215]hat range:x-low,x-high?";
50 input xl,xh
60 print"[200]ow many strips";
70 input n
80 h=(xh-xl)/n
90 s=fna(xl)/2
100 x=xl
110 for j=1 to n-1
120 x=x+h
130 s=s+fna(x)
140 next j
150 s=s+fna(xh)/2
160 a=s*h
170 print"area is ";a